package com.source.barcodeMachineGrantAndRecovery.service.impl;

import com.source.barcodeMachineGrantAndRecovery.VO.BarcodeMachineGrantVO;
import com.source.barcodeMachineGrantAndRecovery.VO.HouseMachineGrantVO;
import com.source.barcodeMachineGrantAndRecovery.entity.HouseMachineGrant;
import com.source.barcodeMachineGrantAndRecovery.mapper.HouseMachineGrantMapper;
import com.source.barcodeMachineGrantAndRecovery.service.HouseMachineGrantService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author IceBerg777
 * @since 2021-04-14
 */
@Service
public class HouseMachineGrantServiceImpl extends ServiceImpl<HouseMachineGrantMapper, HouseMachineGrant> implements HouseMachineGrantService {

    @Autowired
    private HouseMachineGrantMapper grantMapper;

    @Override
    public HouseMachineGrantVO findById(String id) {
        return grantMapper.findById(id);
    }

    @Override
    public List<HouseMachineGrantVO> findAll() {
        return grantMapper.findAll();
    }

    @Override
    public List<HouseMachineGrantVO> findByLike(String keyWord) {
        return grantMapper.findByLike("%"+keyWord+"%");
    }

    @Override
    public HouseMachineGrant findByMachineNumber(String machineNumber) {
        return grantMapper.findByMachineNumber(machineNumber);
    }

    @Override
    public HouseMachineGrant findByMachineNumberAndGrantDate(String machineNumber, String date) {
        return grantMapper.findByMachineNumberAndGrantDate(machineNumber, "%" + date + "%");
    }

    @Override
    public List<HouseMachineGrantVO> findAllDistinct() {
        return grantMapper.findAllDistinct();
    }

    @Override
    public List<HouseMachineGrantVO> findDistinctByLike(String keyWord) {
        return grantMapper.findDistinctByLike("%" + keyWord + "%");
    }

    @Override
    public List<HouseMachineGrant> findUnGranted() {
        return grantMapper.findUnGranted();
    }
}
